package gov.nasa.anml.lifted;

import java.util.*;

import gov.nasa.anml.PDDL;
import gov.nasa.anml.State;
import gov.nasa.anml.utility.*;



/**
 * Action: Store the action structure specified in the domain
 * file. Will be used as the action template to ground actions using object
 * instances from the problem file
 */
public class Action extends Unit<SimpleBoolean,SimpleVoid> {
	
	//public Action(Scope parent) {super(parent);}
	public Action(Scope parent, SimpleString n) {super(parent,n);labels.put(this);}
		//Interval.constantDurationOne // bah, sharing doesn't work.

	public IdentifierCode idCode() {
		return IdentifierCode.Action;
	}

	public TypeCode typeCode() {
		return TypeCode.Boolean;
	}

	public boolean apply(State p, int contextID, State c) {
		// TODO implement action application
		return false;
	}

	public History<SimpleVoid> storage(State p, State c) {
		// TODO lookup its local storage
		// probably change the storage type to LocalState or something like that
		// but perhaps SimpleInteger instead as a lookup into a table to circumvent the SimpleObject
		// supertype restriction.
		// maybe change existing SimpleObject to SimpleBase
		// and then have: class SimpleObject extends SimpleBase<SimpleObject> ?
		// this then lets simple objects have structured members, supporting
		// object and vector types, as well as action storage, which is like
		// object storage (?)
		return null;
	}

	public SimpleBoolean value(State s) {
		// TODO implement lookup of whether or not action is executing in
		// the given state
		return ANMLBoolean.False;
	}

	@Override
	public void translateDecl(PDDL pddl, Interval unit) {
		super.translateDecl(pddl, unit);
		pddl.actions.add(asPDDLAction);
	}

	public gov.nasa.anml.PDDL.Action getPDDLAction() {
		return this.asPDDLAction;
	}

	
	
}
